package leetcode.leetcode_11;

class Solution {
    public int maxArea(int[] height) {
        int left =0 , right = 0 ;
        int ans = 0;
        while(left<right){
            int temp = Math.min(height[left],height[right]);
            ans = Math.max(ans,temp*(right-left));
            if (height[left]<height[right]){
                left++;
            }
            else{
                right--;
            }
        }
        return ans;
        
    }
}